#ifndef SPRITE_H
#define SPRITE_H

#include <conio.h>
#include "Entity.h"
#include "Texture.h"

#include "Text.h"
#include "ShaderEffect.h"

//Draws a square
class Sprite : public Entity
{
	ShaderEffect * shader_test;

	private:
						 ///
		TexCoord texcoords[4];
						 ///
		Text display_name;
						 ///Temporary solution to have the outline of the sprite
		bool UseWire;
						 ///Ptr to Vertex Data
		VOID* pVertices;
						 ///Ptr to Texture Data
		VOID* pTexCoords;
						 ///Ptr to Color  Data
		VOID* pColors;
						 ///Ptr to Index  Data
		WORD* pIndex;

														///Vertex Format Declaration
		LPDIRECT3DVERTEXDECLARATION9 VertexDeclaration;
													    ///Vertex Buffer
		LPDIRECT3DVERTEXBUFFER9 VertexBuffer;
														///Index Buffer
		LPDIRECT3DINDEXBUFFER9  IndexBuffer;
														///Color Buffer
		LPDIRECT3DVERTEXBUFFER9 ColorBuffer;
														///Texture Coordinate Buffer
		LPDIRECT3DVERTEXBUFFER9 TextureBuffer;

	public:

						///Constructor
		Sprite();
						///Destructor
		~Sprite();

												///Builds Sprite
		void init(LPDIRECT3DDEVICE9   d3ddev, b2World * world_physics = NULL);
												///Flip Texture Horizontally
		bool FlipHorizontal();
												///Flip Texture Vertically
		bool FlipVertical();
												///Modify TexCoords Manually
		bool ModifyTexCoords(TexCoord t[]);
												///Drawing Lines Instead
		void WireMode(bool UseWire = true);
												///Set Shader
		void SetShader(ShaderEffect * shader);
												///Render(Draw) Object
		void Render(LPDIRECT3DDEVICE9 d3ddev);
};

#endif